#!/usr/bin/python
# -*- coding: utf-8 -*-

#This file is part of pyLot library.
#
# pyLot is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyLot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with pyLot.  If not, see <http://www.gnu.org/licenses/>.

__author__ = u'Pierre Puiseux, Guillaume Baty'
__copyright__ = u"Copyright 2011-2012 (C) andheo, Université de Pau et des Pays de l'Adour"
__credits__ = [u'Pierre Puiseux', u'Guillaume Baty']
__license__ = "GNU Lesser General Public License"

__all__ = ['hardbook', 'defaultconf']

import sys

from _pylot.minimal.path import Path
from _pylot.minimal.pathbook import PathBook
from _pylot.minimal.system import ENCODING

try :
  __file__
except NameError :
  co = sys._getframe(0).f_code
  __file__ = co.co_filename

root = Path(__file__.decode(ENCODING)).abspath().parent.parent.parent
PYLOT_PYPYLOT_PATH = Path(__file__.decode(ENCODING)).abspath().parent

defaultconf = Path(root, u'pyLot', u'etc')

hardbook = PathBook(alias=u'hardbook')
hardbook.upFromFile(Path(defaultconf, u'hardbook.csv'))
for path_id in hardbook :
  if hardbook[path_id].default_value :
    new_value = hardbook[path_id].default_value.replace(u'@ROOT@', root)
    hardbook[path_id].default_value = Path(new_value).abspath()

hardbook.resetDataToDefault()

#print u'pylot informations:'
#print u'  - pylot library: %s' % hardbook(u'pythonpath')
#print u'  - default config: %s' % hardbook(u'defaultconf')
#print u'  - extensions: %s' % hardbook(u'extensions')
#print
